(navigation image)
Home American Libraries | Canadian Libraries | Universal Library | Community Texts | Project Gutenberg | Children's Library | Biodiversity Heritage Library | Additional Collections
Search: Advanced Search
Anonymous User (login or join us)
Upload
See other formats

Full text of "Programming"

Connecting Your Robot to MyRobots / ThingSpeak 



.1 



Make Projects 



build, hack, tweak, share, discover^ 



Connecting Your Robot to 
MyRobots / ThingSpeak 

Written By: RobotGrrl 

SUMMARY 

Time to let RoboBrrd soar into the clouds! OK, maybe metaphorically speaking. In this guide 
you will be able to connect any Arduino-compatible robot with MyRobots and update its 
sensor data! 

We will be using an Arduino and Processing to send your robot's data to MyRobots. The data 
will be transferred through the USB cable via a serial connection, so your robot won't need 
an onboard Internet connection. 

The same process in this guide will work fine on any configuration of Arduino-compatible 
robots; you will just have to tweak what pins and what data to your specific needs. 

To complete this guide you will need an: 

Internet connectionAccount on MyRobotsArduino (and preferably a robot) 

Here are the resources we will use: 

MyRobotsThingSpeakArduinoProcessingFirmata 

You can look at all the code for this guide on Github: 

SimpleThingSpeak (Processino)ThingSpeak Firmata (Processina)LearninqPet AnaloaFirmata MyRobots (Arduino) 

With that said, let's get started! 



© Make Projects www.makeprojects.com Page 1 of 6 



Connecting Your Robot to MyRobots / ThingSpeak 



Step 1 — Connecting Your Robot to MyRobots / ThingSpeak 



ai*-; 


AddKcta) 


*«**» 


'30BOJ5 




**«. 


*™d«™^ 


MtUbUU 




mom*^ 




WiABCIWB#ri 


■HH»I"| 


UMAQEFIIEHBI 




ADHOtfrAm 




UNAS! THEN J 




rfMCWBT 


*^1: 




vwr 


J - ;!, HiW : '"'- 






Mwi 


^sib>. 


Mi 



!*t-» ■ t L ■ ■ ■£= r™» 



i i J * w. 






-i*\ 



BOTS 



ULKAW BWK1T5 
UMAQEFflEHBI 

jaETHENI 

rr accwht 



iSBEBr-. 



A + 1, »- 


— 


« 


^j^-c-,- 


wi-iiMiiaini 




aPfli *"■** 


IHWI) iinimi 


f J 




«aajntif :* 


.• 


f^ ^r-'-Lf ^'■J - -:--- ■ 


—««««' 




*in*(fc- 


llAfttJUl I'.M* 


Bi 


M ■••#*« qtail ~J M|ta. 


! - 


Hobalird iu. n Am« 


YF-frit 




WfNWM 








* 




_ 


— 




LifliWni 


fiGhlWr-ti 












• First, create a robot on MyRobots . 

• You can customize your robot/channel with your robot's information 

• Go to Manage Robots, and then to your robot. 

• Grab the API Key on the robot's information. 



Step 2 




• Open Processing and create a new sketch. You can download the example 
SimpleThingSpeak sketch on Github . 

• Set apikey to your robot's API Key. 

• Run the code. Make sure you see the numbers appearing in the monitor below. 

• You will know if your data is sent successfully when you see the entry_id number in 
the monitor. 

• Also check that the data is being displayed on your robot's graph on MyRobots. 



© Make Projects 



www.makeprojects.com 



Page 2 of 6 



Connecting Your Robot to MyRobots / ThingSpeak 



Step 3 





f^ "~ ^ SimpleAnatogFicmala | Arduino 0022 




1 




B55 


[S21E10B] •" 1 




FtobaBnd |$] 








iiaURmui L-sli 1 










. 


1 ^ ff> 1 

■■: aWI&JKfL14tall6«K<: pln„ . ' VdLut) 

{ 

it <ISJ>IILPIffl(pin)} { 

<P1 H_T0.W 61TJJ.(pLn ) , fj_" -UT) ; 
nrilwi-i^|^|H_T0jPW!tBin.), wive); 
> 
J 

una MtueC) 
{ 

•:'■:■• i)f 
Fir»altf.ottfii*(JU4ULDG._PeS5J£E, aMlefUflleCalllwdt); 

> 






SSf*Ffi[3J.. a tl<H:h(SEiVM)[ 

o ■: 

umi*(FLr*alo.&,-aiLGbL*()) { 
f irwta .process Input Qj 
> 

,'/ do one anala^tead pec loop, so. If PC (s oendn>j a lot of 
// cnalog writ* ■»! 109*1 , w< w l 1 L only- 4eLgy 1 enclosed 
FtrHU.MndJralog^aialofpin, anal o^tex* (anal Mf> ln))s 
raLoofln . onaloopin + 1; 
:- (erolctfin « 'tWH.jmu&J' J*e> wwletfin - 3; 

ipdaleUghUO; 

!MWj»j*etiMi((iiif)f'P''^- (1, ?)); L 

■on! hotfceyActkodfint. hetksy) { 
.:-.:i.((»Ckey) -[ 
>r»ir-ri-*5c-rt"-(.lt'. 5)n 


.'.-■. ;.? 




dote upiMdi'ig. 








Don* uploading. 



• Use Firmata on your robot's Arduino microcontroller (File>Examples>Firmata). 

• For this guide, I'm using the analog example: SimpleAnalogFirmata. 

• The benefit of using Firmata on the robot is that we will be able to easily access the 
sensors from the Processing sketch! 

• Mix in your robot's code with the Firmata code. 

• In this case, RoboBrrd will just be updating its eyes and doing a random movement. 

• You can look at the example code used in this guide on Github here ! 



C5 



© Make Projects 



www.makeprojects.com 



Page 3 of 6 



Connecting Your Robot to MyRobots / ThingSpeak 



Step 4 




• Open the arduinojnput Processing example sketch (File>Examples>Contributed 
Libraries>Arduino). 

• Run it to test the sensors and the communication. 

• Combine the Arduino Processing code with SimpleThingSpeak to access your robot's 
values. 

• You can get the example ThingSpeakFirmata sketch from Github here ! 

• Run the sketch! Watch for the updated sensor values and make sure that it is sent to 
MyRobots. 



© Make Projects 



www.makeprojects.com 



Page 4 of 6 



Connecting Your Robot to MyRobots / ThingSpeak 



Step 5 



:i 



>OBOTS 

bors Heap the hr>notils 




BOARD 
OBOT 

GE ROBOTS 
GE FRIENDS 

IOEOTAPPS 
GE TOKENS 
COUNT 




RoboBrrd 




RoboB rid 

&01 1-1 £-20 1651PM 



T.5A0D2BOflEFD4Aa6 
JSON XUL CSV Tablfl 



Ndfsic 
Type: 

Croatian Dale : 

Robot ID : 

API Key : 

Channel Faed Lii-iKS 

Got yf 

Shan. Description { see dea-ied crafite haee t ; 

flflboBfrd h an ajiimalronic roboi bind ! Watch tie damn 
*eel hera: rno^Mwv.vouiube »nrt*4lt»i? 
v=g_7SKLHB0BY "Fhft latestvarsinn ol RoboBtrd ftn 
T;i?,s:: Ii:/eg change 11s sehav;3uribas-ea an ■what HFC 
■i ai H is ivoaring Gh*ek it oui imp .<v«w 



Erin k 

ezbsh 

Si RoeoQrrc siys cftrp cm 
Si. ROBOBRRD IS l-.Li S-SR 1 



Q 



,.E£.-;E€. 



♦'■ BLEEP BEEP BQTJP 



RoboBrrd Grain Power 



;;/vwwwwwv 



Left Wins 



Melody 



Right Wing 



iOBOTS 

ibors. Heap the brnpfirs 



fe* 



BOARD 
OBOT 

GE ROBOTS 
GE FRIENDS 

tOEOTAPPS 
GE TOKENS 
COUNT 




RoboBrrd 



Ftol»B r>d 

Anaulno 

SOI 1 -12-20 1651PM 




>5A0D2B0eEFO<lAa& 
JSON XUL CSV Table 



Short Destf ipiiert { see deta -led ar&m* hore : ; 



RoboBrrc! la an ajiirrialronic robe: bind ! Watch the damn 
*eel here: hnp^*w*.Y0wlube.»n»%ft1eti? 
v=g_7SKLHB0BY "Fh* latest varsinn o1 RoboBrrd In an 
fWBbBrhji to change lis behaviours baaed anwlurlNPC 
hfliii is wMfing. Ch*ck Horn- .imp tffcrtw 



ErinK 

Si RoboBrrfl siys ehfpclw 
Si. ROBOBRRD IS HUNSIC 

h BLEEP BEEP BOOF 



RoboBrrd Brain Power 



Left Wing 



Melody 



Right Wing 



• Congrats, you are done! Now your robot's sensor data can be accessed from anywhere in 
the world, by anyone and any robot! 

• If you want to add more data to what your robot is sending, you can look at the MyRobots 
API here. 

• Go crazy with it! ThingSpeak is a pretty awesome platform that can do interesting things 
with your data. Happy hacking! 

There are many more interesting things that you can do with MyRobots and the ThingSpeak 
platform. You can read more about it on their documentation here and here ! 

Add on more features and capabilities, this guide was meant as a stepping stone to help get the 
connection started! 

This tutorial is part of my fundraising effort for travel expenses to go to Maker Faire Bay Area! 
I'm trying to answer the question: "How many MAKE Projects does it take to get to Maker 
Faire?" So if you like this tutorial, you can donate towards my travel expenses here ! Thanks for 
checking it out! 

If you enjoyed this tutorial, you can visit my website where I am up to all sorts of shenanigans! 



CREDITS 



© Make Projects 



www.makeprojects.com 



Page 5 of 6 



Connecting Your Robot to MyRobots / ThingSpeak 
Arduino 

RoboBrrd 

Cloud image 



This document was last generated on 2012-11-03 04:27:05 AM. 



© Make Projects www.makeprojects.com Page 6 of 6